//
//  MovieInfo.swift
//  movieInfo
//
//  Created by zhangkai on 2023/5/13.
//

import UIKit


//错误
enum MIError: String, Error {
    case invalidUrl = "This url is not valid."
    case unableToComplete = "Unable to complete your request. Plese check your internet connection"
    case invalidResponse = "Invalid response from the server. Please try again"
    case invalidData = "The data recieved from the server was invalid."
    case unableToParseData = "The data given does not match the Model."
    case unableToGetImage = "The you are trying to load is not an image"
}





struct Movie: Codable, Hashable {
    var title: String?
    var overview: String?
    var releaseDate: String?
    var genreIds: [Int]?
    var id: Int
    var posterPath: String?
    var backdropPath: String?
    var voteAverage: Double?
    var runtime: Int?
//    var vote_average:Double?
    
    
    
    var saveTime: String?
    
//    [5]    (null)    "vote_average" : Double(8.7)
}

//MARK: - VideoData
struct VideoData : Codable,Hashable {
    let results : [VideoResults]?
}

//MARK: - VideoResults
struct VideoResults : Codable,Hashable {
    let key : String?
}



//-----

struct User: Codable {
    var name: String
    var avatar: gravatar
    var id: Int
}

struct gravatar: Codable {
    var hash: String
}

//----


struct Cast: Codable, Hashable {
    let id: Int
    let name: String?
    let character: String?
    let order: Int?
    let profilePath: String?
}


//----

struct Person: Codable, Hashable {
    let name: String
    let id: Int
    let birthday: String?
    let biography: String
    let placeOfBirth: String?
    let profilePath: String?
}
